//
//  DKHomeHelperAlertView.m
//  DanKU
//
//  Created by 吴斌 on 2023/12/8.
//

#import "DKHomeHelperAlertView.h"
@interface DKHomeHelperAlertView()
@property (nonatomic, weak)zhPopupController * dk_HomeHelperAlertViewPop;
@property (copy, nonatomic) void (^finishCompletion)(void);

@property (nonatomic, strong)UITextView * dk_loanScoreTextView;
@property (nonatomic, strong)UIButton * dk_LoanScoreBtn;

@property (nonatomic, copy)NSString * cureenRate;
@end
@implementation DKHomeHelperAlertView
-(instancetype)init{
    if(self == [super init]){
        self.backgroundColor = UIColor.whiteColor;
        self.layer.cornerRadius = 50;
        self.clipsToBounds = YES;
        [self dk_addSubView];
    }
    return self;
}
- (void)dk_addSubView{
    UILabel *dk_LoanScoreHeadLab = [[UILabel alloc] init];
    dk_LoanScoreHeadLab.textColor = DK_Hex(@"#333333");
    dk_LoanScoreHeadLab.font = DK_FONT_Medium(17);
    dk_LoanScoreHeadLab.text = @"Description：";
    [self addSubview:dk_LoanScoreHeadLab];
    [dk_LoanScoreHeadLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self);
        make.top.equalTo(@(DK_IsWidthScale(30)));
        make.height.equalTo(@(DK_IsWidthScale(24)));
    }];
    UIButton * dk_LoanScoreCloseBtn = [[UIButton alloc] init];
    [dk_LoanScoreCloseBtn setBackgroundImage:DK_GetImage(@"dk_LoginAgreementClose") forState:UIControlStateNormal];
    [dk_LoanScoreCloseBtn addTarget:self action:@selector(goCancle) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:dk_LoanScoreCloseBtn];
    [dk_LoanScoreCloseBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@(DK_IsWidthScale(20)));
        make.right.equalTo(@(-DK_IsWidthScale(20)));
        make.height.equalTo(@(DK_IsWidthScale(17)));
        make.width.equalTo(@(DK_IsWidthScale(17)));
    }];
    UILabel* helperLab = [[UILabel alloc] init];
    helperLab.textColor = DK_Hex(@"#333333");
    helperLab.font = DK_FONT_Regular(14);
    helperLab.text = @"Limit remaining=Available quota for loan applications\nLimit frozen=Applications under review or releasing process\nLimit used= Total loan amount  released successfully";
    helperLab.numberOfLines = 0;
    [self addSubview:helperLab];
    [helperLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@(DK_IsWidthScale(20)));
        make.right.equalTo(@(-DK_IsWidthScale(20)));
        make.top.equalTo(dk_LoanScoreHeadLab.mas_bottom).offset(DK_IsWidthScale(19));
    }];
}
- (void)goCancle{
    [self.dk_HomeHelperAlertViewPop dismiss];
}
+ (void)dk_ShowHomeHelperAlertView:(void(^)(void))complete{
    DKHomeHelperAlertView * dk_HomeHelperAlertView = [[DKHomeHelperAlertView alloc] init];
    zhPopupController * homeHelperAlertCtrl = [[zhPopupController alloc] initWithView:dk_HomeHelperAlertView size:CGSizeMake(DK_SCREEN_W - DK_IsWidthScale(60), DK_IsWidthScale(248))];
    homeHelperAlertCtrl.presentationStyle = zhPopupSlideStyleTransform;
    homeHelperAlertCtrl.layoutType = zhPopupLayoutTypeCenter;
    homeHelperAlertCtrl.presentationTransformScale = 0.56;
    homeHelperAlertCtrl.dismissonTransformScale = 0.56;
    homeHelperAlertCtrl.dismissOnMaskTouched = NO;
    dk_HomeHelperAlertView.dk_HomeHelperAlertViewPop = homeHelperAlertCtrl;
    dk_HomeHelperAlertView.finishCompletion = complete;
    [homeHelperAlertCtrl showInView:((AppDelegate*)([UIApplication sharedApplication].delegate)).window completion:^{
    }];
}

@end
